package lzq.aop.config;

import java.sql.SQLException;
import java.util.List;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import lzq.aop.domain.Course;
import lzq.aop.service.CourseService;


public class MainStarter {

	public static void main(String[] args) throws SQLException {
		
		AnnotationConfigApplicationContext ctx=new AnnotationConfigApplicationContext(MyConfig.class);
		CourseService courseService=ctx.getBean(CourseService.class);
		Course course=new Course("张三",90);
		courseService.create(course);
		System.out.println("新增couse的id="+course.getId());
		
		List<Course> courses=courseService.queryAllCourse();
		courses.forEach(System.out::println);
		
		ctx.close();
	}
}
